# -- coding: utf-8 --
import cv2
import numpy as np
import matplotlib.pyplot as plt 
from skimage import measure,data,color

img1 = cv2.imread("/DataSet/Gastroscope biopsy/384*384/181039（2）/181039（2）_20.bmp")
#img2 = cv2.imwrite("canny.bmp",cv2.Canny(img1,384,384))
img = color.rgb2gray(img1)
contours = measure.find_contours(img,0.5)
fig,axes = plt.subplots(1,2,figsize = (8,8))
ax0,ax1 = axes.ravel()
ax0.imshow(img,plt.cm.gray)
ax0.set_title('orifinal image')
rows,cols = img.shape
ax1.axis([0,rows,cols,0])
for n, contour in enumerate(contours):
	ax1.plot(contour[:,1],contour[:,0],linewidth = 2)
ax1.axis('image')
ax1.set_title(contours)
plt.show()
#cv2.imshow("image",img1)
#cv2.imshow("canny",img2)
#cv2.waitKey()
#cv2.destroyAllWindows()